<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core">
        
        <f:metadata>
                <f:viewParam name="user" value="#{userEdit.user}" converter="#{userConvertor}" />
                <f:event listener="#{userEdit.preRenderView()}" type="preRenderView"/>
        </f:metadata>
        
        <h:head>
                <title>User list</title>
        </h:head>
        
        <h:body>
                
                <li>Apple</li>
                <li>Strawberry</li>

                <h:messages />
                
                <h:form>
                        
                        <h:panelGrid columns="2">
                                <f:facet name="header">User</f:facet>
                                
                                <h:outputLabel value="Id" rendered="#{!empty userEdit.user.id}" />
                                <h:outputLabel value="#{userEdit.user.id}" rendered="#{!empty userEdit.user.id}" />
                                        
                                <h:outputLabel for="firstName" value="First name" />
                                <h:inputText id="firstName" value="#{userEdit.user.firstName}" label="First name" />
                                
                                <h:outputLabel for="lastName" value="Last name" />
                                <h:inputText id="lastName" value="#{userEdit.user.lastName}" label="Last name"  />
                                
                                <h:outputLabel for="birthDay" value="Birth day" />
                                <h:inputText id="birthDay" value="#{userEdit.user.birthday}" label="Birth day">
                                        <f:convertDateTime pattern="dd-MM-yyyy"/>
                                </h:inputText>
                                
                                <h:outputLabel for="email" value="Email" />
                                <h:inputText id="email" value="#{userEdit.user.email}" />
                        
                                <h:commandButton action="#{userEdit.saveUser}" value="Submit" />
                                <h:button outcome="index.xhtml" value="Cancel"  />
                        </h:panelGrid>
                </h:form>
        
        </h:body>
</html>